package example.pattern.abstractfactory;

public class Application {
	public Application(String os){
		GUIFactory factory= getButtonFactory(os);
		if(factory!=null){
			factory.createButton().paint();
		}else{
			System.out.println(os + " is not supported");
		}
	}
	
	
	private GUIFactory getButtonFactory(String os){
		if("win".equalsIgnoreCase(os)){
			return new WinFactory();
		}else if("mac".equalsIgnoreCase(os)){
			return new MacFactory();
		}else{
			// add new concrete factory
			return null;
		}
	}

}
